package com.baizhi.service.impl;

import com.baizhi.entity.Hero;
import com.baizhi.mapper.HeroMapper;
import com.baizhi.service.HeroService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class HeroServiceImpl implements HeroService {
    @Autowired
    private HeroMapper mapper;
    @Override
    public void addHero(Hero hero) {
        mapper.addHero(hero);
    }

    @Override
    public void removeHero(Integer id) {
        mapper.deleteHero(id);
    }

    @Override
    public void updateHero(Hero hero) {
        mapper.updateHero(hero);
    }

    @Override
    public Hero showHeroById(Integer id) {
        return mapper.showHeroById(id);
    }

    @Override
    public PageInfo<Hero> showHeroS(Integer pageNum, Integer pageSize) {
        return new PageInfo<>(mapper.showHeros(pageNum, pageSize));
    }
}
